package ex4;

public class Library implements Print {
	
	private Book [] books;
	private Reader [] readers;
	
	
	public Library() {
		
		this.books = new Book [1000];
		this.readers = new Reader[300];
	}
	
	public void addBook(Book book){
		for ( int i = 0; i < books.length; i++){
			if (books[i] == null){
				books[i] = book;
				break;
			}
			
			
		}
	}

	public void addReader(Reader reader){
		for ( int i = 0; i < readers.length; i++){
			if (readers[i] == null){
				readers[i] = reader;
				break;
			}
			
			
		}
	}

	public Book[] getBooks() {
		return books;
	}


	public void setBooks(Book[] books) {
		this.books = books;
	}


	public Reader[] getReaders() {
		return readers;
	}


	public void setReaders(Reader[] readers) {
		this.readers = readers;
	}
	
	
	public void printBooks(){
		System.out.println(" Books list");
		for (int i = 0; i < books.length; i++){
			if (books[i] != null){
			System.out.println(books[i]);
			}
		}
		System.out.println();
	}
	
	public void printReaders(){
		System.out.println("Readers list");
		for(int j = 0; j < readers.length; j++){
			if (readers[j] != null){
			System.out.println(readers[j]);
			}
			
		}
		
	}
	
	
	

}
